#!/bin/ksh

ram=$(top -b -n 1 | grep "Memory: " | awk '{print $6}')
disk_root=$(df -h / 2>/dev/null | grep '\/$' | awk '{print $4}')
disk_home=$(df -h /home 2>/dev/null | grep '\/home$' | awk '{print $4}')
cpu_temp=$(sysctl hw.sensors | grep -e "cpu0.temp0" -e "acpithinkpad0.temp0" | cut -d"=" -f 2 | awk '{print $1}')
audio_device=$(sndioctl server.device | awk -F= '{print $2}')
audio_level=$(sndioctl output.level | awk -F= '{print $2}')
batt=$(apm -l)
date=$(date '+%Y-%m-%d %H:%M')
ip_address_public=$(curl --silent --connect-timeout 1 ifconfig.me)
ip_address_private=$(ifconfig -a | grep "inet 192.168." | awk '{print $2}' | head -1)
top_proc=$(top -b -n 1 | grep $(whoami) | awk '{print $11"|"$10}')
echo "ip:$ip_address_public ip:$ip_address_private ad:$audio_device al:$audio_level degC:$cpu_temp /:$disk_root /home:$disk_home top:$top_proc R:$ram B:$batt | $date"
